{% load i18n %}

{% load avatar_tags %}
{% load groups_tags %}
{% load user_messages %}

<table class="table table-striped table-bordered table-condensed">
    <tbody>
    {% for thread in threads %}
        {% random_uuid as input_id %}
        {% is_unread thread request.user as unread_flag %}
        {% format_senders thread request.user as senders_repr %}
        <tr>
            <td class="col-sm-1">
                <div class="inbox-checkbox">
                    <input name=thread_{{ thread.pk }} id={{ input_id }} type="checkbox">
                    <label for={{ input_id }} class="inbox-marker-checkmark"></label>
                </div>
            </td>
            <td class="col-md-3">
                <a href="{{ thread.get_absolute_url }}" style="{% if unread_flag %}font-weight:bold{% endif %}">{{ senders_repr }} <span
                            style="font-size:10px;">{{ thread.num_messages }}</span></a>
            </td>
            <td class="col-md-3">
                <a href="{{ thread.get_absolute_url }}" style="{% if unread_flag %}font-weight:bold{% endif %}">{{ thread.subject }} - {{ thread.latest_message.content|slice:"10" }}...</a>
            </td>
            <td class="col-md-3">
                {{ thread.latest_message.sent_at}}
            </td>
            <td class="col-md-1">
                <form method="post" action="{% url "messages_thread_delete" thread.pk %}">
                    {% csrf_token %}
                    <button class="btn btn-danger message_delete_btn">{% trans "Delete" %}</button>
                </form>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>

